package package06章_面向对象编程_基础._05oop.exer1_methodMore._03_valueTransfer;

/**
 * @ClassName: e_6_10valueTransferTest
 * @Author 86132
 * @Package package06章_面向对象编程_基础.oop05.exer1_methodMore._03_valueTransfer
 * @Date 2024/2/13 11:34
 * @description:
 */
public class e_6_10valueTransferTest1 {
    public static void main(String[] args) {
        e_6_10valueTransferTest1 test = new e_6_10valueTransferTest1();

        //1. 对于基本数据类型的变量来说
        int m = 10;
        test.method1(m);

        System.out.println("m = " + m);//10
        //2. 对于引用数据类型的变量来说
        Person p = new Person();
        p.age = 10;
        test.method2(p);

        System.out.println(p.age); //11
    }

    public void method1(int m) {
        m++;
    }

    public void method2(Person p) {
        p.age++;
    }
}

class Person {
    int age;
}